/**
 * Copyright (C) 2013-2014 the original author or authors.
 */
package com.foreveross.bsl.mam.rbac.application;

import java.util.List;

import javax.ws.rs.DELETE;
import javax.ws.rs.FormParam;
import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;
import javax.ws.rs.Produces;
import javax.ws.rs.core.MediaType;

import org.springframework.data.domain.Page;

import com.foreveross.bsl.common.utils.web.QuerySpecs;
import com.foreveross.bsl.mam.rbac.application.vo.AdminVO;

/**
 * @description
 * 
 * @author rening
 * @version v1.0
 * 
 * @2013-6-7
 * 
 */
@Path(value = "/admins")
@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
public interface AdminApplication {

	@POST
	@Path("/")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public AdminVO saveEntity(AdminVO entity);

	@PUT
	@Path("/{id}")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public AdminVO updateEntity(@PathParam("id") String id, AdminVO entity);

	@DELETE
	@Path("/{id}")
	public void deleteEntity(@PathParam("id") String id);
	
	@GET
	@Path("/{id}")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public AdminVO getEntity(@PathParam("id") String id);
	
	@GET
	@Path("/")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public List<AdminVO> findAll();

	@POST
	@Path("/pages")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public Page<AdminVO> findByPageable(
			@FormParam("pageNumber") int pageNumber,
			@FormParam("pageSize") int pageSize,
			@FormParam("q") QuerySpecs querySpecs);

	@GET
	@Path("/search/{username}/{password}")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public AdminVO getEntityByUserNameAndPassword(@PathParam("username") String username,@PathParam("password") String password);
	
	@GET
	@Path("/search/{username}")
	@Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
	public AdminVO getEntityByUserName(@PathParam("username") String username);
	
}
